package com.zhbr.mvp.presenter;

import com.zhbr.common.rx.BaseSubscriber;
import com.zhbr.entity.Account;
import com.zhbr.mvp.base.presenter.BasePresenter;
import com.zhbr.mvp.contract.AlterAccountContract;
import com.zhbr.mvp.model.AlterAccountModel;
import com.zhbr.mvp.ui.activity.AlterAccountActivity;

public class AlterAccountPresenter extends BasePresenter<AlterAccountActivity, AlterAccountModel> implements AlterAccountContract.Presenter {


    @Override
    protected AlterAccountModel createModule() {
        return new AlterAccountModel();
    }

    @Override
    public void alterAccount() {

    }

    @Override
    public void getAccountInfo() {
        mModel.getAccountInfo(new BaseSubscriber<Account>() {

            @Override
            public void onSuccess(Account data) {
                if (isViewAttach()){
                    getView().getAccountInfoSuccess(data);
                }
            }

            @Override
            public void onFailed(Throwable ex, String code, String msg) {
                onFailed(ex, code, msg);
            }

            @Override
            public void onError() {
                onNetError();
            }
        });
    }
}
